﻿///////////////////////////////////////////////////////////////////////////////
//
// This file is part of the BassDrop project
//   https://code.google.com/p/bass-drop/
//
//
// Creator:	Gergely Krajcsovszki (krajcsovszkig@hotmail.com)
// Date:	2014-03-14 14:50
//
//
// Copyright © 2013-2014. Gergely Krajcsovszki
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
//   http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.
//
///////////////////////////////////////////////////////////////////////////////
using System;

namespace BassDrop.Core.Common.Cloud
{
	/// <summary>
	/// Represents the current state of readyness of this object or the current operation being performed on it
	/// </summary>
	public enum RemoteFileObjectState
	{
		/// <summary>
		/// The object is being initialized, please wait for correct state information
		/// </summary>
		Initializing,
		/// <summary>
		/// A local copy is readily available of the file
		/// </summary>
		Local,
		/// <summary>
		/// No local copy is available, fetching needed
		/// </summary>
		Remote,
		/// <summary>
		/// The file is currently being pushed to the server
		/// </summary>
		Pushing,
		/// <summary>
		/// The file is currently being fetched from the server
		/// </summary>
		Fetching,
		/// <summary>
		/// An error occured while synchronizing the file with the server.
		/// See the Error property
		/// </summary>
		Error
	}

	/// <summary>
	/// Common interface for object that can be synchronized with their representation in the cloud
	/// </summary>
	public interface ISynchronizable
	{
		/// <summary>
		/// Object providing the connection to the cloud storing this object
		/// </summary>
		CloudConnectionBase CloudConnection
		{
			get;
		}

		/// <summary>
		/// The last error that occured while managing this item or null if none occured yet
		/// </summary>
		Exception Error
		{
			get;
		}

		/// <summary>
		/// The current state of readyness of this object or the current operation being performed on it
		/// </summary>
		RemoteFileObjectState State
		{
			get;
		}

		/// <summary>
		/// Can the item be synchronized currently, is it actually remote
		/// or just a local file stored as a remote file object
		/// </summary>
		bool Synchronizable
		{
			get;
		}

		/// <summary>
		/// Schedule the (asynchronous) synchronization of this object with the one stored in the cloud
		/// </summary>
		void ScheduleSynchronize();
	}
}
